home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-08-16 | 4.3 KB | 189 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWCursor.cpp
- // Release Version: $ ODF 1 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #include "FWOS.hpp"
-
- #ifndef FWCURSOR_H
- #include "FWCursor.h"
- #endif
-
- #ifndef PRCURSOR_H
- #include "PRCursor.h"
- #endif
-
- #ifndef FWSOMENV_H
- #include "FWSOMEnv.h"
- #endif
-
- #ifndef FWEXCLIB_H
- #include "FWExcLib.h"
- #endif
-
- #ifndef FWRESFIL_K
- #include "FWResFil.k"
- #endif
-
- #ifndef FWRESFIL_H
- #include "FWResFil.h"
- #endif
-
- #ifndef FWRESTYP_H
- #include "FWResTyp.h"
- #endif
-
- #ifndef FWSTDDEF_H
- #include "FWStdDef.h"
- #endif
-
- #ifndef FWCFMRES_H
- #include "FWCFMRes.h"
- #endif
-
- #if defined(FW_BUILD_MAC) && !defined(__RESOURCES__)
- #include <Resources.h>
- #endif
-
- #if defined(FW_BUILD_MAC) && !defined(__TOOLUTILS__)
- #include <ToolUtils.h>
- #endif
-
- #if defined(FW_BUILD_MAC) && !defined(__LOWMEM__)
- #include <LowMem.h>
- #endif
-
- //========================================================================================
- // Runtime Informations
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- #pragma segment fwtoolbx
- #endif
-
- //========================================================================================
- // CLASS FW_CCursor
- //========================================================================================
-
- FW_DEFINE_AUTO(FW_CCursor)
-
- //----------------------------------------------------------------------------------------
- // FW_CCursor::FW_CCursor
- //----------------------------------------------------------------------------------------
- // Create an arrow cursor
-
- FW_CCursor::FW_CCursor() :
- fInstance(FW_gInstance),
- fCursorID(FW_kArrowCursor),
- fCursorHandle(NULL),
- fMacIsColor(FALSE)
- {
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CCursor::FW_CCursor
- //----------------------------------------------------------------------------------------
-
- FW_CCursor::FW_CCursor(FW_CursorID cursorID, FW_Instance instance) :
- fInstance(instance),
- fCursorID(cursorID),
- fCursorHandle(NULL),
- fMacIsColor(FALSE)
- {
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CCursor::~FW_CCursor
- //----------------------------------------------------------------------------------------
-
- FW_CCursor::~FW_CCursor()
- {
- FW_START_DESTRUCTOR
-
- if (fCursorHandle != NULL)
- {
- #ifdef FW_BUILD_MAC
- if(fMacIsColor)
- ::DisposeCCursor((CCrsrHandle)fCursorHandle);
- else
- ::DisposeHandle((FW_PlatformHandle)fCursorHandle);
- #endif
- #ifdef FW_BUILD_WIN
- ::DestroyCursor(fCursorHandle);
- #endif
- }
-
- fCursorHandle = NULL;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CCursor::Select
- //----------------------------------------------------------------------------------------
-
- void FW_CCursor::Select() const
- {
- FW_CCursor* self = (FW_CCursor*)this;
-
- self->PrivLoadCursor();
-
- #ifdef FW_BUILD_MAC
- if (fCursorHandle != NULL)
- {
- if(fMacIsColor)
- ::SetCCursor((CCrsrHandle)fCursorHandle);
- else
- ::SetCursor(*fCursorHandle);
- }
- else
- ::SetCursor(&FW_QDGlobals.arrow);
-
- #endif
-
- #ifdef FW_BUILD_WIN
- FW_ASSERT(fCursorHandle != NULL);
- ::SetCursor(fCursorHandle);
- #endif
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CCursor::PrivLoadCursor
- //----------------------------------------------------------------------------------------
-
- void FW_CCursor::PrivLoadCursor()
- {
- if (fCursorHandle != NULL)
- return;
-
- #ifdef FW_BUILD_MAC
- if (fCursorID == FW_kArrowCursor)
- return;
- #endif
-
- FW_SOMEnvironment ev;
- fCursorHandle = FW_PrivLoadCursor(ev, fInstance, fCursorID, fMacIsColor);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CCursor::GetHandle
- //----------------------------------------------------------------------------------------
- // On the Mac returns NULL for the arrow cursor
-
- FW_PlatformCursorHandle FW_CCursor::GetHandle() const
- {
- FW_CCursor* self = (FW_CCursor*)this;
- self->PrivLoadCursor();
-
- #ifdef FW_BUILD_WIN
- FW_ASSERT(fCursorHandle);
- #endif
-
- return fCursorHandle;
- }
-
-